package com.onefish.toolkit.ESAPI;

import org.owasp.esapi.Validator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ESAPIHandler {
    @Autowired
    private Validator esapiValidator;

    public String validInput(String input) {
        try {
            return esapiValidator.getValidInput("Input validation", input, "SafeString", 100, false);
        } catch (Exception e) {
            // Handle validation exception
            e.printStackTrace();
            return "Input validation: Invalid input!";
        }
    }
}
